﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Dracham.Classes
{
    public class NetworkParameter
    {
        private Byte[] text;
        private Int32 length;

        public NetworkParameter(String text, Int32 length)
        {
            this.length = length;
            this.text = this.GetParameter(text);
        }

        public NetworkParameter(Byte[] text, Int32 length)
        {
            this.length = length;
            this.text = text;
        }

        public Byte[] GetParameter()
        {
            return this.text;
        }

        public Byte[] GetParameter(String txt)
        {
            Byte[] b = new Byte[this.length];
            Byte[] tb = Encoding.UTF8.GetBytes(txt);

            for (Int32 i =0; i < tb.Length; i++)
            {
                if (i > b.Length) break;
                b[i] = tb[i];
            }

            return b;
        }
    }
}
